/* GUI CONVERTED from rqrqrp4.p (converter v1.76) Thu Aug  2 17:25:25 2001 */
/* rqrqrp4.p - REQUISITION HISTORY REPORT                                     */
/* Copyright 1986-2002 QAD Inc., Carpinteria, CA, USA.                        */
/* All rights reserved worldwide.  This is an unpublished work.               */
/* $Revision: 1.5.1.3 $                                                         */
/*                                                             */
/*V8:ConvertMode=FullGUIReport                                                */
/* Revision: 8.6    LAST MODIFIED BY: 04/22/97  By: B. Gates          *J1Q2*  */

/* REVISION: 8.6E     LAST MODIFIED: 02/23/98   BY: *L007* A. Rahane */
/* REVISION: 8.6E     LAST MODIFIED: 04/29/98   BY: A. Shobha         *K1NZ*  */
/* REVISION: 8.6E     LAST MODIFIED: 10/04/98   BY: *J314* Alfred Tan         */
/* REVISION: 9.1      LAST MODIFIED: 03/24/00   BY: *N08T* Annasaheb Rahane */
/* REVISION: 9.1      LAST MODIFIED: 08/12/00   BY: *N0KP* myb                */
/* $Revision: 1.5.1.3 $    BY: Tiziana Giustozzi  DATE: 07/03/01 ECO: *N104*          */
/******************************************************************************/
/* All patch markers and commented out code have been removed from the source */
/* code below. For all future modifications to this file, any code which is   */
/* no longer required should be deleted and no in-line patch markers should   */
/* be added.  The ECO marker should only be included in the Revision History. */
/******************************************************************************/


/*GUI global preprocessor directive settings */
&GLOBAL-DEFINE PP_PGM_RP TRUE
&GLOBAL-DEFINE PP_ENV_GUI TRUE


/*GUI preprocessor directive settings */
&SCOPED-DEFINE PP_GUI_CONVERT_MODE REPORT

{mfdtitle.i "b+ "}

/* ********** Begin Translatable Strings Definitions ********* */

&SCOPED-DEFINE rqrqrp4_p_1 "Display E-mail Ids"
/* MaxLen: Comment: */

&SCOPED-DEFINE rqrqrp4_p_2 "Email!Sent To"
/* MaxLen: Comment: */

/* ********** End Translatable Strings Definitions ********* */

define variable nbr like rqm_mstr.rqm_nbr no-undo.
define variable nbr1 like rqm_mstr.rqm_nbr label {t001.i} no-undo.
define variable enterdate like rqh_date no-undo.
define variable enterdate1 like rqh_date label {t001.i} no-undo.
define variable apr_userid like rqh_apr_userid no-undo.
define variable apr_userid1 like rqh_apr_userid label {t001.i} no-undo.
define variable show_email_ids like mfc_logical
   label {&rqrqrp4_p_1} no-undo.
define variable email_sent_to as character
   column-label {&rqrqrp4_p_2}.

define variable dummychar as character no-undo.
define variable numentries as integer no-undo.
define variable i as integer no-undo.

{rqconst.i}


/*GUI preprocessor Frame A define */
&SCOPED-DEFINE PP_FRAME_NAME A

FORM /*GUI*/ 
   
 RECT-FRAME       AT ROW 1.4 COLUMN 1.25
 RECT-FRAME-LABEL AT ROW 1   COLUMN 3 NO-LABEL
 SKIP(.1)  /*GUI*/
nbr             colon 20
   nbr1            colon 49
   enterdate       colon 20
   enterdate1      colon 49
   apr_userid      colon 20
   apr_userid1     colon 49
   skip(1)
   show_email_ids  colon 30
   skip
 SKIP(.4)  /*GUI*/
with frame a side-labels width 80 attr-space NO-BOX THREE-D /*GUI*/.

 DEFINE VARIABLE F-a-title AS CHARACTER.
 F-a-title = &IF (DEFINED(SELECTION_CRITERIA) = 0)
  &THEN " Selection Criteria "
  &ELSE {&SELECTION_CRITERIA}
  &ENDIF .
 RECT-FRAME-LABEL:SCREEN-VALUE in frame a = F-a-title.
 RECT-FRAME-LABEL:WIDTH-PIXELS in frame a =
  FONT-TABLE:GET-TEXT-WIDTH-PIXELS(
  RECT-FRAME-LABEL:SCREEN-VALUE in frame a + " ", RECT-FRAME-LABEL:FONT).
 RECT-FRAME:HEIGHT-PIXELS in frame a =
  FRAME a:HEIGHT-PIXELS - RECT-FRAME:Y in frame a - 2.
 RECT-FRAME:WIDTH-CHARS IN FRAME a = FRAME a:WIDTH-CHARS - .5. /*GUI*/

/*GUI preprocessor Frame A undefine */
&UNDEFINE PP_FRAME_NAME



/* SET EXTERNAL LABELS */
setFrameLabels(frame a:handle).

{wbrp01.i}


/*GUI*/ {mfguirpa.i true "printer" 132 " " " " " "  }

/*GUI repeat : */
/*GUI*/ procedure p-enable-ui:

   if nbr1 = hi_char then nbr1 = "".
   if enterdate = low_date then enterdate = ?.
   if enterdate1 = hi_date then enterdate1 = ?.
   if apr_userid1 = hi_char then apr_userid1 = "".

   if c-application-mode <> 'WEB' then
   
run p-action-fields (input "display").
run p-action-fields (input "enable").
end procedure. /* p-enable-ui, replacement of Data-Entry GUI*/

/*GUI*/ procedure p-report-quote:


   {wbrp06.i &command = update
      &fields = "  nbr nbr1 enterdate enterdate1
                        apr_userid apr_userid1 show_email_ids"
      &frm = "a"}

   if (c-application-mode <> 'WEB') or
      (c-application-mode = 'WEB' and
      (c-web-request begins 'DATA')) then do:

      bcdparm = "".
      {mfquoter.i nbr}
      {mfquoter.i nbr1}
      {mfquoter.i enterdate}
      {mfquoter.i enterdate1}
      {mfquoter.i apr_userid}
      {mfquoter.i apr_userid1}
      {mfquoter.i show_email_ids}

      if nbr1 = "" then nbr1 = hi_char.
      if enterdate = ? then enterdate = low_date.
      if enterdate1 = ? then enterdate1 = hi_date.
      if apr_userid1 = "" then apr_userid1 = hi_char.

   end.

   /* OUTPUT DESTINATION SELECTION */
   
/*GUI*/ end procedure. /* p-report-quote */
/*GUI - Field Trigger Section */

/*GUI MFSELxxx removed*/
/*GUI*/ procedure p-report:
/*GUI*/   {gpprtrpa.i "printer" 132 " " " " " " " " }
/*GUI*/   mainloop: do on error undo, return error on endkey undo, return error:



   {mfphead.i}

   for each rqh_hist no-lock
         where rqh_nbr >= nbr and rqh_nbr <= nbr1
         and rqh_date >= enterdate and rqh_date <= enterdate1
         and rqh_apr_userid >= apr_userid and rqh_apr_userid <= apr_userid1
         use-index rqh_nbr
         break by rqh_nbr by rqh_date by rqh_time by rqh_seq_nbr with frame b:
      {gplngn2a.i
         &file=""rqh_hist""
         &field=""rqh_action""
         &code=rqh_action
         &mnemonic=dummychar
         &label=action_desc}

      /* SET EXTERNAL LABELS */
      setFrameLabels(frame b:handle).

      display
         rqh_nbr
         rqh_line
         rqh_date
         string(rqh_time,"HH:MM:SS") @ rqh_time
         action_desc @ rqh_action
         rqh_apr_userid
         rqh_ent_userid
         rqh_rtto_userid
      with width 132 STREAM-IO /*GUI*/ .

      if show_email_ids then do:
         numentries = num-entries(rqh_email_list).

         do i = 1 to numentries:
            if i > 1 then down 1.
            email_sent_to = entry(i,rqh_email_list).
            display email_sent_to WITH STREAM-IO /*GUI*/ .
         end.
      end.
   end.

   
/*GUI*/ {mfguitrl.i} /*Replace mfrtrail*/

/*GUI*/ {mfgrptrm.i} /*Report-to-Window*/

end.

{wbrp04.i &frame-spec = a}

/*GUI*/ end procedure. /*p-report*/
/*GUI*/ {mfguirpb.i &flds=" nbr nbr1 enterdate enterdate1 apr_userid apr_userid1 show_email_ids "} /*Drive the Report*/
